curr=$(cd "$(dirname "$0")";pwd)
dm_home=$(cd "$curr/../dm8";pwd)
mkdir -p $curr/../../dmdata_tpcc
dm_data=$(cd "$curr/../../dmdata_tpcc";pwd)
echo "dm_home: "$dm_home/bin " dm_data: "$dm_data
redo_size="2048"
kill -9 $(ps -ef|grep ${dm_home}/bin |gawk '$0 !~/grep/ {print $2}' |tr -s '\n' ' ')
sleep 10
chmod +x $curr/DmService $curr/alterini.py
rm -rf ${dm_data}
export LD_LIBRARY_PATH=$dm_home/bin
sed -i '/^DM_HOME/c DM_HOME="'${dm_home}'"' ${curr}/DmService
sed -i '/^INI_PATH/c INI_PATH='${dm_data}'/DAMENG/dm.ini' ${curr}/DmService
cd $dm_home/bin
./dminit path=${dm_data} page_size=32 extent_size=32 SYSDBA_PWD=Dameng123 SYSAUDITOR_PWD=Dameng123  port_num=5236
$curr/DmService start
sleep 60
cp ${curr}/DmService ${dm_data}
./disql SYSDBA/Dameng123@127.0.0.1:5236 << EOF
ALTER TABLESPACE "ROLL" RESIZE DATAFILE 'ROLL.DBF' TO 1024;
ALTER DATABASE RESIZE LOGFILE 'DAMENG01.log' TO ${redo_size};
ALTER DATABASE RESIZE LOGFILE 'DAMENG02.log' TO ${redo_size};
exit
EOF
#modfiy the manual parameters
#python ${curr}/alterini.py ${dm_data}/DAMENG/dm.ini ${curr}/dm.ini
sleep 1
$curr/DmService restart
sleep 1
$curr/DmService restart
sleep 30
